package struts.action;

import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.omg.CORBA.ARG_OUT;

import struts.annotation.ParseAnnotation;
import struts.utility.AnnotationBean;

/**
 * 监听器
 * 项目启动时，解析com.xsoft包下的注解
 * @author Administrator
 *
 */
public class ActionListener implements ServletContextListener {

	public ActionListener() {
	}

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		System.out.println("信息：系统已注销！");
	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		ServletContext context = arg0.getServletContext();
		
		try {
			Map<String, AnnotationBean> map = ParseAnnotation.parseAnnotation("com.xsoft"); 
			context.setAttribute("strutsConfig", map);
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println("信息：系统已经加载完成");
	}
}
